(function () {
  class WarningTextLayer extends BaseLayer {
    constructor(config = {}) {
      super(config);
      this.minZoom = 0
      this.maxZoom = 21
      this.iconSize = .5;
      this.name =  'WarningTextLayer'
      this.noneTips = true // 不显示提示
      this.initLayer({
        layout: {
          'text-field': ['get', 'text'],
          'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'],
          'text-size': 16,
        },
        paint: {
          'text-color': ['get', 'color']
        }
      })
    }

    makeFeature(item) {
      let f = {
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: item.position
        },
        properties: {
          icon: item.icon,
          data: item,
          text: item.text,
          color: item.color,
        }
      }
      return f
    }
    loadData() {
      this.cacheData = [
        {
          position: [128.04038318888308, 30.840505969406507],
          text: '24\n小\n时\n警\n戒\n线',
          color: '#f00',
        },
        {
          position: [132.85047150998076, 30.642516860239965],
          text: '48\n小\n时\n警\n戒\n线',
          color: '#ff0',
        },
      ]
      this.refreshLayer()
    }
  }


  window.addEventListener('mapCreatedEvent', ev => {
    new WarningTextLayer()
  })
})();
